﻿@model PcaWeb.Areas.Admin.Models.ChangePasswordUserModel

@{
    var X = Html.X();
}

@(
    X.Window()
        .ID("winCambiarPassword")
        .Title(string.Format("Cambiar password usuario \"{0}\"", Model.UserName))
        .Resizable(false)
        .Icon(Icon.UserAdd)
        .Layout(LayoutType.Fit)
        .Width(450)
        .Modal(true)
        .Constrain(true)
        .BodyPadding(5)
        .Items(
            X.FormPanel()
                .ID("formCambiarPassword")
                .Layout(LayoutType.Form)
                .BodyPadding(5)
                .FieldDefaults(fieldDefaults => { fieldDefaults.LabelWidth = 180; })
                .Items(
                    X.HiddenFor(m => m.UserName),
                    X.TextFieldFor(m => m.NewPassword),
                    X.TextFieldFor(m => m.ConfirmPassword)
                )
                .Buttons(
                    X.Button()
                        .Text("Registrar")
                        .Icon(Icon.Disk)
                        .DirectEvents(de =>
                        {
                            de.Click.Url = Url.Action("CambiarPassword", "Usuarios");
                            de.Click.Method = HttpMethod.POST;
                            de.Click.Before = "PcaGlobal.fnValidarForm";
                            de.Click.Success = "App.winCambiarPassword.close();";
                            de.Click.Failure = "PcaGlobal.showError(result.msg);";
                            de.Click.EventMask.ShowMask = true;
                            de.Click.EventMask.Msg = "Registrando...";
                        })
                )
        )
)
